<template>
  <div v-if="visible" class="dialog-overlay" >
    <div class="dialog-content" @click.stop>
      <slot></slot>
      <div class="close-button" @click="close">
        <img src="/svg/exitIcon.svg" />
      </div>
    </div>
  </div>
</template>

<script lang="ts">
import { defineComponent, ref } from 'vue';

export default defineComponent({
  name: 'Dialog',
  props: {
    visible: {
      type: Boolean,
      required: true
    },
    close: {
      type: Function,
      required: true
    }
  }
});
</script>

<style scoped>
.dialog-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
}
.dialog-content {
  background: white;
  border-radius: 8px;
  max-width: 90%;
  max-height: 90%;
  position: relative;
}
.close-button {
  position: absolute;
  top: 25px; /* 距离顶部的距离 */
  right: 140px; /* 距离右侧的距离 */
}
</style>
